import pytest
import os

result = 'result'
report = 'report'


lst = ['test01_pytest_allure.py','test02_pytest_allure_class.py','--alluredir',result]

# 1. 通过pytest生成测试数据
pytest.main(lst)

# 2. 在python中运行allure命令
cmd = "allure generate {} -o {} -c".format(result,report)
os.system(cmd)

cmd1 = "allure open -h localhost -p 82 report"
os.system(cmd1)